//
// Created by Administrator on 2023/8/3.
//

#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int minMaxGame(vector<int> &nums) {
        // 模拟这个过程即可
        if (nums.size() == 1) return nums[0];
        vector<int> newNums;
        for (int i = 0; i < nums.size(); i += 2) {
            if (i % 4 == 0)
                newNums.push_back(min(nums[i], nums[i + 1]));
            else
                newNums.push_back(max(nums[i], nums[i + 1]));
        }
        return minMaxGame(newNums);
    }
};


int main() {
    Solution s;
    vector<int> nums = {1, 3, 5, 2, 4, 8, 2, 2};
    cout << s.minMaxGame(nums) << endl;
    return 0;
}